package com.example.smart_city_0829.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.example.smart_city_0829.R;
import com.example.smart_city_0829.base.BaseActivity;
import com.example.smart_city_0829.view.MaxSizeWebView;

import java.util.Objects;

public class CommWebViewActivity extends BaseActivity {

    public static final String INTENT_TITLE = "title";
    public static final String INTENT_SUB = "sub";
    public static final String INTENT_TAG = "tag";
    public static final String INTENT_CONTENT = "content";


    private TextView title;
    private TextView sub;
    private TextView tag;
    private MaxSizeWebView web;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_comm_web_view;
    }

    @Override
    protected void initView() {
        title = (TextView) findViewById(R.id.title);
        sub = (TextView) findViewById(R.id.sub);
        tag = (TextView) findViewById(R.id.tag);
        web = (MaxSizeWebView) findViewById(R.id.web);
    }

    @Override
    protected void initData() {
        final Intent intent = getIntent();

        title.setText(Objects.requireNonNull(intent.getStringExtra(INTENT_TITLE)));
        setTitle(title.getText().toString());
        sub.setText(Objects.requireNonNull(intent.getStringExtra(INTENT_SUB)));
        tag.setText(Objects.requireNonNull( intent.getStringExtra(INTENT_TAG)));
        web.loadDataWithBaseURL(null,Objects.requireNonNull(intent.getStringExtra(INTENT_CONTENT)),null,"UTF-8",null);
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected String getActionBarTitle() {
        return "";
    }
}